package mlz.d_tcp3;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/*
    服务器端实现
 */
public class Server {
    public static void main(String[] args) throws IOException {
        System.out.println("-----服务器启动-----");

        //1.创建serversocket对象
        ServerSocket serverSocket = new ServerSocket(8888);

        //2.使用serversocket对象调用对应的方法,等待客户端连接请求
        Socket socket = serverSocket.accept();
        System.out.println("有客户端上线了!!" + socket.getRemoteSocketAddress());
        //3.负责数据处理
        new ServerReaderThread(socket).start();


    }
}
